from PySide6.QtWidgets import QApplication, QComboBox, QVBoxLayout, QWidget

import sys

class MyWindow(QWidget):
    def __init__(self) -> None:
        super().__init__()
        self.setWindowTitle("MyWindow")
        cb = QComboBox()
        cb.addItems(['张三', '里斯', '往往'])
        # cb.setEditable(True)
        cb.currentTextChanged.connect(self.textChanged)
        cb.currentIndexChanged.connect(lambda: print(cb.currentIndex()))
        
        layout = QVBoxLayout()
        layout.addWidget(cb)
        self.setLayout(layout)

    def textChanged(self, text):
        print(text)

if __name__ == '__main__':
    app = QApplication(sys.argv)

    window = MyWindow()
    window.show()

    app.exec()